namespace com.tc.zigbee.mt
{

    using System.Collections.Generic;


    using com.tc.gateway.device;
    using com.tc.gateway;
    using com.tc.zigbee.entity;
    using com.tc.zigbee.entity.device;
    using com.tc.zigbee.mt.request;
    using com.tc.zigbee.zcl;
    using com.tc.zigbee.zcl;

    public class ZigbeeSceneManager : SceneManager
    {
        ZigbeeManager manager;
        public ZigbeeSceneManager(ZigbeeManager zm)
        {
            manager = zm;
        }
        public void recall(byte id)
        {
            ZigbeeScene scene = (ZigbeeScene)manager.getScenes()[id];
            foreach (Device d in scene.getParent().getMembers())
            {
                Endpoint e = ((ZigbeeDevice)d).getEndpoint();
                byte[] c = ZclCommandCreator.recallScene((byte)0, scene.getGroup(), scene.getScene());
                MtCommand mc = RequestFactory.MtAfDataRequest(
                        (byte)2,
                        e.getParent()
                        .getNwkAddress(),

                        e.getEndpointId(),
                        (byte)manager.getRemoteControl()
                        .getEndpointId(),
                        (short)ZclConstants.ZCL_CLUSTER_ID_GEN_SCENES,
                        (byte)0,
                        (byte)0,
                        (byte)2,
                        (byte)c.Length,
                        c);
                RequestQueue.offer(mc);
            }

        }

        public List<Scene> getAll()
        {
            // TODO Auto-generated method stub
            List<Scene> rst = new List<Scene>(manager.getScenes().Values);
            return rst;
        }


    }
}
